<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<h1>加法运算</h1>
		<input type="text" id="input1"/>
		+
		<input type="text" id="input2"/>
		<button onclick="add()">=</button>
		<input type="text" id="input3"/>
		<br />
		<h2>乘法运算</h2>
		<input type="text" id="input4"/>
		*
		<input type="text" id="input5"/>
		<button onclick="mul()">=</button>
		<input type="text" id="input6"/>
		
		<script>
			
			// 定义一个函数
			function add()
			{
				console.log("calc()进行计算");
				var num1 = parseInt(input1.value);
				var num2 = parseInt(input2.value);
				var num3 = num1+num2;
				input3.value = num3;
				
			}
			
			function mul()
			{
				console.log("calc()进行计算");
				var num4 = parseInt(input4.value);
				var num5 = parseInt(input5.value);
				var num6 = num4*num5;
				input6.value = num6;
				
			}
		</script>
	</body>
</html>
